package chapter5.service.impl;

import chapter5.dao.AdminDao;
import chapter5.dao.impl.AdminDaoImpl;
import chapter5.entity.Admin;
import chapter5.service.AdminService;

import java.util.List;

public class AdminServiceImpl implements AdminService {
    @Override
    public int loginAdmin(Admin admin) {
        int count=0;
        if (admin!=null){
            AdminDaoImpl impl=new AdminDaoImpl();
            count=impl.login(admin);
        }
        return count;
    }

    @Override
    public int adminService(Admin admin) {
        int count=0;
        if (admin!=null){
            AdminDaoImpl impl=new AdminDaoImpl();
            count=impl.Xz(admin);
        }
        return count;


    }

    @Override
    public int delete(String delete) {
        int count=0;
        if (delete!=null){
            AdminDaoImpl impl=new AdminDaoImpl();
            count=impl.delete(delete);
        }
        return count;
    }

    @Override
    public int update(Admin admin) {
        int count=0;
        if (admin!=null){
            AdminDaoImpl impl=new AdminDaoImpl();
            count=impl.update(admin);
        }else{
            count=-1;
        }
        return count;
    }

    @Override
    public List<Admin> selct() {
        AdminDao adminDao=new AdminDaoImpl();

        return adminDao.selct();
    }
}
